<template>
  <div>
    <el-container>
      <el-main>
        <div class="header-button-style">
          <el-button icon="el-icon-arrow-left" @click.native="returnButton">返回</el-button>
          <el-button icon="el-icon-printer" @click.native="printerButton">打印</el-button>
        </div>
        <el-container v-for="item in orderInfo" 
        :key="item"
                  :label="item"
                  :value="item"
        class="parent-body">
          <el-header class="content-header">
            订单信息
          </el-header>
          <el-main class="info-main padding-style">
            <el-table :data="item.list" border style="width: 100%">
               <!-- 这里skuid -->
              <el-table-column prop="skuId" label="货号"> </el-table-column>
              <el-table-column prop="name" label="商品名称"> </el-table-column>
              <el-table-column prop="price" label="价格"> </el-table-column>
              <!-- 这里关联sku表 -->
              <el-table-column prop="skuVo.spec" label="属性"> </el-table-column>
              <el-table-column prop="num" label="数量"> </el-table-column>
              <el-table-column prop="money" label="小计"> </el-table-column>
            </el-table>
          </el-main>
          <el-footer class="footer01">
            <!-- order表 -->
            <span>商品总价：￥{{item.order.totalMoney}}</span>
            <span>运费：￥{{item.order.postFee}}</span>
            <span>订单总金额：￥{{item.order.totalMoney}}</span>
            <span>支付方式：  <span v-if="item.order.payType=1">在线支付</span> 
            <span v-if="item.order.payType=0">货到付款</span>
            </span>
          </el-footer>
          <el-footer  class="footer02">
            <div>
              <div>{{item.order.receiverMobile}}</div>
              <div>
                <div><span>手机号码：{{item.order.receiverMobile}}</span><span>提交时间：{{item.order.createTime}}</span></div>
                <div><span>订单编号：{{item.order.transactionId}}</span><span>收货地址：{{item.order.receiverAddress}}</span></div>
              </div>
            </div>

            <!-- 这里是条形码，现在没数据 -->
            <!-- <div class="barCode">
              <img :src="sss" />
            </div> -->
          </el-footer>
        </el-container>
      </el-main>
    </el-container>
  </div>
</template>

<script>
 import orderItem from "@/api/order/orderItem";
    export default {
        data() {
            return {
// 装order的数据
              orderOne:{},
              // item表的数据
              orderInfo:[],
            }
        },
        methods:{
            returnButton(){
                this.$router.replace({ path: "/order/orderList" });
            },
            printerButton(){
                alert("执行打印...");
            },

            // 获取数据列表
intData(ids){
  orderItem.getByIdList(ids).then(response=>{
    console.log(response);
    this.orderInfo=response.data.data;
  })
}
        },

        mounted(){

 var ids = this.$route.query.ids;
 console.log(ids);
 this.intData(ids);

        }
    }
</script>

<style scoped>
  .parent-body{
    border:1px solid #E4E4E4;
    margin-bottom:40px;
  }
  .content-header{
    height:50px;
    line-height: 50px;
    background-color:#F3F3F3;
    color:#666666;
    text-align: center;
    font-size: 20px;
    font-weight: bolder;
  }
  .info-main{
    background-color:#fff;
  }

  .padding-style{
    padding:0 !important;
  }
  .header-button-style{
    text-align: right;
    margin-bottom:10px;
  }
  .footer01{
    text-align: right;
    height:60px;
    line-height: 60px;
    font-size:13px;
    color:#666666;
    border-bottom: 1px solid #ccc;
  }
  .footer01>span{
    margin-left:20px;
  }
  .footer02{
    padding:20px 10px;
    height: 120px !important;
    line-height: 30px;
    font-size:13px;
    color:#666666;
  }
  .footer02>div:first-of-type{
    display: inline-block;
    width:700px;
  }
  .footer02 div>span{
    display: inline-block;
    width: 300px;
  }
  .barCode{
    text-align: right;
    display: inline-block;
    width:500px;
  }
</style>
